﻿using System.Collections.Generic;
using DuplicateFileFinder.Model;

namespace DuplicateFileFinder.Business
{
    public class DupeFinder
    {
        public FileProperty GetDuplicate(FileProperty sourceFile, IList<FileProperty> list)
        {
            foreach (var fp in list)
            {
                if (sourceFile.Length != fp.Length)
                    continue;

                if (new FileComparer().Compare(sourceFile.Path, fp.Path) == CompareResult.Equal)
                    return fp;
            }
            return null;
        }
    }
}
